<!-- @author zhengjie -->
<template>
  <div class="">

    <!-- 侧边导航++++++++++++++++++++++ -->
    <el-menu :default-active="defaultActive" class=" mt_20 ml_20 elmenu " background-color="#fff" text-color="#000000"
      active-text-color="#000000">

      <div class="space-between center" style="padding: 20px;">
        <div class="row center">
          <img style="width: 34px;height: 34px;margin-right: 20px;" :src="game_logo" />
          <div class="f_14">{{game_name}}</div>
        </div>

        <img class="cursor" style="width: 16px;height: 12px;" src="@/assets/images/jtzy.png" @click="toUrl('/center')" />
      </div>

      <el-menu-item index="1" class="item_nav" @click="toUrl('/center/overview')">
        <img style="height: 20px;width: 20px;margin-right: 10px;" src="@/assets/images/zll.png" />
        <span slot="title">总览</span>
      </el-menu-item>




      <el-submenu index="2" class="item_nav">
        <template slot="title">
          <img style="height: 20px;width: 20px;margin-right: 10px;" src="@/assets/images/kff.png" />
          <span>开发</span>
        </template>
        <el-menu-item index="2-1" @click="toUrl('/center/gameConfiguration')">游戏配置</el-menu-item>
        <el-menu-item index="2-2" @click="toUrl('/center/gameConfiguration')">客户端资源</el-menu-item>
        <el-menu-item index="2-3" @click="toUrl('/center/gameConfiguration')">常用工具</el-menu-item>
        <el-menu-item index="2-4" @click="toUrl('/center/gameConfiguration')">使用手册</el-menu-item>
      </el-submenu>

      <el-submenu index="3" class="item_nav">
        <template slot="title">
          <img style="height: 20px;width: 20px;margin-right: 10px;" src="@/assets/images/cww.png" />
          <span>财务</span>
        </template>
        <el-menu-item index="3-1" @click="toUrl('/center/playerRechargeRecord')">玩家充值记录</el-menu-item>
        <el-menu-item index="3-2" @click="toUrl('/center/settlementInformation')">结算信息</el-menu-item>
        <el-menu-item index="3-3">待处理订单</el-menu-item>
        <el-menu-item index="3-4">异常订单</el-menu-item>
      </el-submenu>



      <el-submenu index="4" class="item_nav">
        <template slot="title">
          <img style="height: 20px;width: 20px;margin-right: 10px;" src="@/assets/images/yunyi.png" />
          <span>运营</span>
        </template>
        <el-menu-item index="4-1" @click="toUrl('/index')">数据分析</el-menu-item>
      </el-submenu>


      <el-submenu index="5" class="item_nav">
        <template slot="title">
          <img style="height: 20px;width: 20px;margin-right: 10px;" src="@/assets/images/szz.png" />
          <span>设置</span>
        </template>
        <el-menu-item index="5-1" @click="toUrl('/center/personal')">个人信息设置</el-menu-item>
        <el-menu-item index="5-2" @click="toUrl('/center/settleAccounts')">结算信息设置</el-menu-item>
      </el-submenu>

    </el-menu>
    <!-- 侧边导航=============== -->
  </div>
</template>

<script>
  import {
    getToken,
    setToken,
    removeToken
  } from '@/utils/auth'
  export default {
    name: 'Sidebar',

    props: {
      defaultActive: {
        type: String,
        default: '4-1'
      },

    },
    data() {
      return {
        game_id: '',
        game_name: '',
        game_logo: '',

      }
    },
    created() {

      this.game_id = localStorage.getItem('game_id')
      this.game_name = localStorage.getItem('game_name')
      this.game_logo = localStorage.getItem('game_logo')

    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },

      handleClick(command) {
        var token = getToken();
        if (!token) {
          this.$message({
            message: '请先登录',
            type: 'warning'
          });
        }
        // this.$message('click on item ' + command);
        if (command == 'a') {
          this.toUrl('/center/PersonalCertificate')
        }

        if (command == 'd') {
          this.toUrl('/center/gameConfiguration')
        }



      },
      toUrl(url) {
        console.log('navv', url)

        this.$router.push({
          path: url
        })
      },


      childMethod() {
        this.$parent.fatherMethod();
      }

    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .elmenu {
    border-radius: 10px;
    padding-top: 20px;
    height: 880px;
  }

  ::v-deep .el-submenu__title {
    font-size: 18px;
  }

  ::v-deep .el-menu-item.is-active {
    background: #779EFE !important;

  }

  ::v-deep .el-menu-item * {
    font-size: 18px;

  }

  ::v-deep .el-menu-item.is-active {
    background: #779EFE !important;

  }
</style>
